<template>  
    <div class="student">  
      <p>登陆页面</p>  
      <input type="text" v-model="username">  
      <input type="password" v-model="password">  
      <button @click="login">登录</button>  
    </div>     
    </template>      
      
    <script>  
    export default {  
      data() {  
        return {  
          username: '',  
          password: '',  
        };  
      },  
      methods: {  
        login() {    
          const isLoginValid = this.validateLogin();  
          if (isLoginValid) {              
            this.$router.push('/login');  
          } else {   
            alert('用户名或密码错误！');  
          }  
        },  
        validateLogin() {  
          return this.username === 'admin' && this.password === '123456';  
        },  
      },  
    };  
    </script>